<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<%@ include file="/commons/head.jsp" %>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <%@ include file="/commons/left.jsp" %>
    <div class="content-wrapper">
        <section class="content-header">
            <h1>
                专利信息
            </h1>
        </section>
        <div class="content">
            <div class="row">
                <div class="col-md-9">
                    <div class="box box-primary" style="overflow:hidden">
                        <form id="postForm" class="form-horizontal" autocomplete="off">
                            <input type="hidden" name="Id" value="${entity.id}">
                            <div class="box-body" style="padding-top:30px">
                                <div class="form-group">
                                    <label for="applicationNumber" class="col-sm-2 control-label">申请号：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="applicationNumber"
                                               name="applicationNumber" value="${entity.applicationNumber}" placeholder="申请号">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="accreditTime" class="col-sm-2 control-label">授权入库日：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="accreditTime"
                                               name="accreditTime" value='<fmt:formatDate pattern="yyyy-MM-dd" value="${entity.accreditTime}"/>' readonly="readonly"
                                               onfocus="WdatePicker()" placeholder="授权入库日">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="applyTime" class="col-sm-2 control-label">申请日：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="applyTime"
                                               name="applyTime" value='<fmt:formatDate pattern="yyyy-MM-dd" value="${entity.applyTime}"/>' readonly="readonly"
                                               onfocus="WdatePicker()" placeholder="申请日">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inventionName" class="col-sm-2 control-label">专利名称：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="inventionName"
                                               name="inventionName" value="${entity.inventionName}" placeholder="专利名称">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="agencyCode" class="col-sm-2 control-label">代理机构代码：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="agencyCode"
                                               name="agencyCode" value="${entity.agencyCode}" placeholder="代理机构代码">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="agencyName" class="col-sm-2 control-label">代理机构名称：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="agencyName"
                                               name="agencyName" value="${entity.agencyName}" placeholder="代理机构名称">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="mainNumber" class="col-sm-2 control-label">主分类号：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="mainNumber"
                                               name="mainNumber" value="${entity.mainNumber}" placeholder="主分类号">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="patentName" class="col-sm-2 control-label">专利权人名称：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="patentName"
                                               name="patentName" value="${entity.patentName}" placeholder="专利权人名称">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="patentAdder" class="col-sm-2 control-label">专利权人地址：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="patentAdder"
                                               name="patentAdder" value="${entity.patentAdder}" placeholder="专利权人地址">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="patentEmile" class="col-sm-2 control-label">专利权人邮箱：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="patentEmile"
                                               name="patentEmile" value="${entity.patentEmile}" placeholder="专利权人邮箱">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="patentType" class="col-sm-2 control-label">专利类型：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="patentType"
                                               name="patentType" value="${entity.patentType}" placeholder="专利类型">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="patentHolder" class="col-sm-2 control-label">专利权人类型：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="patentHolder"
                                               name="patentHolder" value="${entity.patentHolder}" placeholder="专利权人类型">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="provincep" class="col-sm-2 control-label">省份：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="provincep"
                                               name="provincep" value="${entity.provincep}" placeholder="省份">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="city" class="col-sm-2 control-label">城市：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="city"
                                               name="city" value="${entity.city}" placeholder="城市">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="selectIsStatis" class="col-sm-2 control-label">状态：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control select2 select2-hidden-accessible"
                                                id="selectIsStatis"
                                                style="width: 100%;" tabindex="-1" aria-hidden="true" name="isStatus">
                                            <option value="0" <c:if test="${0 == entity.isStatus}">selected="selected"</c:if>>禁用</option>
                                            <option value="1" <c:if test="${1 == entity.isStatus}">selected="selected"</c:if>>启用</option>
                                            <option value="2" <c:if test="${2 == entity.isStatus}">selected="selected"</c:if>>推荐</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="box-footer">
                                <div class="col-sm-2"></div>
                                <button type="button" class="btn btn-info" onclick="submitForm()">提交</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <%@ include file="/commons/script.jsp" %>
    <script type="text/javascript" src="${ctx}/dist/js/jquery.form.js"></script>
    <script type="text/javascript" src="${ctx}/plugins/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">

        function submitForm() {
            var id = $('#postForm').find('input[name=Id]').val();
            var url = null;
            if (id == null || id == "") {
                url = "${ctx}/patent/savePatent?action=add";
            } else {
                url = "${ctx}/patent/savePatent?action=update";
            }
            $.ajax({
                cache: false,
                type: "post",
                url: url,
                data: $('#postForm').serialize(),// formid
                error: function () {
                    alert("系统异常");
                },
                success: function (data) {
                    if (data !== null) {
                        if (data == 0) {
                            //修改失败
                            alert('失败');
                        } else {
                            //添加/修改成功
                            alert('成功');
                            window.location.href = "${ctx}/patent/listPatent";
                        }
                    }
                }
            });
        }
    </script>
</body>
</html>
